//
//  ViewController.swift
//  SwiftTest
//
//  Created by diannao on 2017/12/18.
//  Copyright © 2017年 QiKai. All rights reserved.
//


import UIKit



let kScreenWidth = UIScreen.main.bounds.size.width
let kScreenHeight = UIScreen.main.bounds.size.height


class ViewController: UIViewController {
    var tf1 = UITextField()
    var tf2 = UITextField()
    var logbtn = UIButton()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "登录"

        tf1 = UITextField()
        tf1.placeholder = "请输入用户名"
        tf1.font = UIFont.systemFont(ofSize: 14)
        tf1.layer.borderWidth = 1;
        tf1.layer.borderColor = UIColor.gray.cgColor
        tf1.layer.cornerRadius = 4
        self.view.addSubview(self.tf1)
        self.tf1.snp.makeConstraints { (make) in
            make.height.equalTo(45)
            make.width.equalTo(kScreenWidth - 100)
            make.centerX.equalTo(self.view)
            make.centerY.equalTo(self.view).offset(-100)
        }
        tf2 = UITextField()
        tf2.placeholder = "请输入密码"
        tf2.font = UIFont.systemFont(ofSize: 14)
        tf2.layer.borderWidth = 1;
        tf2.layer.borderColor = UIColor.gray.cgColor
        tf2.layer.cornerRadius = 4
        self.view.addSubview(self.tf2)
        tf2.snp.makeConstraints { (make) in
            make.size.equalTo(tf1)
            make.centerX.equalTo(view)
            make.top.equalTo(tf1.snp.bottom).offset(20)
        }
        
        logbtn = UIButton()
        logbtn.backgroundColor = UIColor.green
//        logbtn.setTitle("登录", for: UIControl.State.normal)
        logbtn.setTitleColor(UIColor.black, for: UIControl.State.normal)
        logbtn.layer.cornerRadius = 4
        logbtn.addTarget(self, action:#selector(tap(_sender:)), for: UIControl.Event.touchUpInside)
        self.view.addSubview(logbtn)
        logbtn.snp.makeConstraints { (make) in
            make.centerX.equalTo(view)
            make.top.equalTo(tf2.snp.bottom).offset(50)
            make.height.equalTo(45)
            make.width.equalTo(kScreenWidth/3)
        }

     
        
    }
    @objc func tap(_sender:UIButton){
        let ll = FirstViewController()
        self.navigationController?.pushViewController(ll, animated: false)
    }
    func funcName( name1 str:String, name2 m:String) -> String {

        let ss = str + m
        print(ss)
        return ss
        
    }
  
    
    /*
     
     */
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.view.endEditing(true)
       
        
        
        
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    
    
    
    

}

